﻿using System;

namespace Test30.Engine
{
    public class PoisonAction : Action
    {
        public PoisonAction(Entity entity, int damage)
            : base(entity)
        {
            //### bob: needs tuning.
            _duration = damage;
        }

        protected override ActionResult OnProcess()
        {
            // only poison up to 1/5 the entity's health
            Entity.Conditions.Poison.SetDuration(Math.Min(Entity.Conditions.Poison.TurnsRemaining + _duration, Entity.Health.Max / 5));

            return ActionResult.Done;
        }

        private readonly int _duration;
    }
}
